import { useInitDataSingleton } from './shared';
import { BasXueYePinZhongApi, BasXueYePinZhongOutput, BasXueYePinZhongAllOutput } from '/@/api/bas/BasXueYePinZhong';

const { list, initList: initXueYePinZhongList, initListForce: initXueYePinZhongListForce } = useInitDataSingleton<BasXueYePinZhongAllOutput>(BasXueYePinZhongApi.all);

// 血液品种, 必须在登录后初始化
export { initXueYePinZhongList, initXueYePinZhongListForce };

export const xueYePinZhongList = computed(() => {
	return list.value;
});

// 根据id获取
export function getXueYePinZhongInfo(id: number) {
	return list.value.find((item) => item.id == id);
}

// 根据id获取
export function getXueYePinZhongMingCheng(id: number) {
	return list.value.find((item) => item.id == id)?.mingCheng ?? '';
}
